//
//  WSConst.m
//  WSBaseKit
//
//  Created by zhangcong on 2020/8/14.
//  Copyright © 2020 zhangcong. All rights reserved.
//

#import "WSConst.h"


// Error Code
NSInteger const kAppNSErrorInitConfigCode = 1000L;
NSString *const kAppNSErrorDomain                       = @"com.youka.SanGuoXianHua";
NSInteger const kAppNSErrorServer = -1;
NSInteger const kAppNSErrorDeviceIdError                      = 10036;
NSInteger const kAppNSErrorNoSkill                      = 30012;
NSInteger const kAppNSErrorSkillError                      = 30013;
NSInteger const kAppNSErrorNoLogin                      = 10021;
NSInteger const kAppNSErrorTokenExpired                 = 401;
NSInteger const kAppNSErrorTokenCode                    = kAppNSErrorInitConfigCode +1;
NSInteger const kAppNSErrorJsonCode                     = kAppNSErrorTokenCode+ 1;
NSInteger const kAppNSErrorCheckDataCode                = kAppNSErrorJsonCode+ 1;
NSInteger const kAppNSErrorLoginCode                = kAppNSErrorCheckDataCode+ 1;

NSInteger const kAppNSErrorForbidComment                   = 40001;
NSInteger const kAppNSErrorLoginCodeNoAccount                    = 10;
NSInteger const kAppNSErrorLoginCodeErrorPwd                    = 11;
NSInteger const kAppNSErrorLoginCodeLimited                    = 17;

NSInteger const kAppNSErrorCodeError                    = 2;
NSInteger const kAppNSErrorRegisterFail                     = 3;
NSInteger const kAppNSErrorAlreadyRegister                = 122;
NSInteger const kAppNSErrorCodeExpired                    = 102;
NSInteger const kAppNSErrorCodeRequestTooFast                    = 10035;
NSInteger const kAppNSErrorCodeUnKnow                    = 99999;
NSInteger const kAppNSErrorCode500                    = 3480;
NSInteger const kAppNSErrorCodeParameterError           = 20158 ;       //



static CGFloat static_statusbarHeight = 0.f;
CGFloat getScreenWidth()
{
    static CGFloat s_scrWidth = 0.f;
    if (s_scrWidth == 0.f){
        s_scrWidth = CGRectGetWidth([UIScreen mainScreen].bounds);
    }
    return s_scrWidth;
}

CGFloat getScreenHeight()
{
    static CGFloat s_scrHeight = 0.f;
    if (s_scrHeight == 0.f){
        s_scrHeight = CGRectGetHeight([UIScreen mainScreen].bounds);
    }
    return s_scrHeight;
}

CGFloat getStatusBarHeight()
{
    if (static_statusbarHeight == 0.f) {
        CGRect statusBarFrame = [UIApplication sharedApplication].statusBarFrame;
        static_statusbarHeight = MIN(statusBarFrame.size.width, statusBarFrame.size.height);
    }
    return static_statusbarHeight;
}

void setStatusBarHeight(CGFloat newH)
{
    static_statusbarHeight = newH;
}
